﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class UserCtrol_UserStatus : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (Session["AdminId"] != null)  //管理员用户
            {
                lblWelcome.Text = "您好, " + Session["AdminName"].ToString();
                lnkbtnManage.Visible = true;
                lnkbtnPwd.Visible = true;
                lnkbtnLogout.Visible = true;
            }
            else if (Session["CustomerId"] != null)  //一般用户
            {
                lblWelcome.Text = "您好, " + Session["CustomerName"].ToString();
                lnkbtnPwd.Visible = true;
                lnkbtnOrder.Visible = true;
                lnkbtnLogout.Visible = true;
            }
            else if (Session["EmployeeId"] != null)  //一般用户
            {
                lblWelcome.Text = "您好, " + Session["EmployeeName"].ToString();
                lnkbtnPwd.Visible = true;
                lnkbtnOrder.Visible = true;
                lnkbtnLogout.Visible = true;
            }
            else
            {
                // 未登录状态
                lblWelcome.Text = "您还未登录！";
                lnkbtnPwd.Visible = false;
                lnkbtnManage.Visible = false;
                lnkbtnOrder.Visible = false;
                lnkbtnLogout.Visible = false;
            }
        
        }
    }

   /* protected void lnkbtnLogout_Click(object sender, EventArgs e)
    {
        Session.Clear();
        Response.Redirect("~/Login.aspx");
    }*/

    protected void lnkbtnLogout_Click1(object sender, EventArgs e)
    {
        Session.Clear();
        Response.Redirect("~/Login.aspx");
    }

//    protected void lnkbtnLogout_Click2(object sender, EventArgs e)
//    {

//    }
}